package com.boulderai.mcp.model.llm;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
 * 大模型响应模型
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class LlmResponse {
    
    @JsonProperty("id")
    private String id;
    
    @JsonProperty("object")
    private String object;
    
    @JsonProperty("created")
    private Long created;
    
    @JsonProperty("model")
    private String model;
    
    @JsonProperty("choices")
    private List<LlmChoice> choices;
    
    @JsonProperty("usage")
    private LlmUsage usage;
    
    @JsonProperty("system_fingerprint")
    private String systemFingerprint;
    
    public LlmResponse() {}
    
    // Getters and Setters
    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getObject() {
        return object;
    }
    
    public void setObject(String object) {
        this.object = object;
    }
    
    public Long getCreated() {
        return created;
    }
    
    public void setCreated(Long created) {
        this.created = created;
    }
    
    public String getModel() {
        return model;
    }
    
    public void setModel(String model) {
        this.model = model;
    }
    
    public List<LlmChoice> getChoices() {
        return choices;
    }
    
    public void setChoices(List<LlmChoice> choices) {
        this.choices = choices;
    }
    
    public LlmUsage getUsage() {
        return usage;
    }
    
    public void setUsage(LlmUsage usage) {
        this.usage = usage;
    }
    
    public String getSystemFingerprint() {
        return systemFingerprint;
    }
    
    public void setSystemFingerprint(String systemFingerprint) {
        this.systemFingerprint = systemFingerprint;
    }
    
    /**
     * 选择项
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class LlmChoice {
        
        @JsonProperty("index")
        private Integer index;
        
        @JsonProperty("message")
        private LlmMessage message;
        
        @JsonProperty("finish_reason")
        private String finishReason;
        
        @JsonProperty("logprobs")
        private Object logprobs;
        
        public LlmChoice() {}
        
        // Getters and Setters
        public Integer getIndex() {
            return index;
        }
        
        public void setIndex(Integer index) {
            this.index = index;
        }
        
        public LlmMessage getMessage() {
            return message;
        }
        
        public void setMessage(LlmMessage message) {
            this.message = message;
        }
        
        public String getFinishReason() {
            return finishReason;
        }
        
        public void setFinishReason(String finishReason) {
            this.finishReason = finishReason;
        }
        
        public Object getLogprobs() {
            return logprobs;
        }
        
        public void setLogprobs(Object logprobs) {
            this.logprobs = logprobs;
        }
    }
    
    /**
     * 使用统计
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class LlmUsage {
        
        @JsonProperty("prompt_tokens")
        private Integer promptTokens;
        
        @JsonProperty("completion_tokens")
        private Integer completionTokens;
        
        @JsonProperty("total_tokens")
        private Integer totalTokens;
        
        public LlmUsage() {}
        
        // Getters and Setters
        public Integer getPromptTokens() {
            return promptTokens;
        }
        
        public void setPromptTokens(Integer promptTokens) {
            this.promptTokens = promptTokens;
        }
        
        public Integer getCompletionTokens() {
            return completionTokens;
        }
        
        public void setCompletionTokens(Integer completionTokens) {
            this.completionTokens = completionTokens;
        }
        
        public Integer getTotalTokens() {
            return totalTokens;
        }
        
        public void setTotalTokens(Integer totalTokens) {
            this.totalTokens = totalTokens;
        }
    }
}